package com.example.adapter_sdk.quick;

import android.util.Log;

import androidx.recyclerview.widget.DiffUtil;

import java.util.List;

public class BaseQuickDiff<T> extends DiffUtil.Callback {

    private List<T> old_data;
    private List<T> new_data;

    public BaseQuickDiff(List<T> old_data, List<T> new_data) {
        this.old_data = old_data;
        this.new_data = new_data;
    }

    @Override
    public int getOldListSize() {
        return old_data.size();
    }

    @Override
    public int getNewListSize() {
        return new_data.size();
    }

    @Override
    public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
        return old_data.get(oldItemPosition) == new_data.get(newItemPosition);
    }

    @Override
    public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
        Log.e("hxw1",old_data.get(oldItemPosition).toString());
        return old_data.get(oldItemPosition).toString().equals(new_data.get(newItemPosition).toString());
    }
}
